
import request from "@/utils/request";


// 用户登录
export const login = data =>{
  return  request({
        method: "POST",
        url: "/mp/v1_0/authorizations",
        data
      })
}

// 获取用户信息
export const getUserProfile = data =>{
  const user = JSON.parse(localStorage.getItem('user'))
  return  request({
        method: "GET",
        url: "/mp/v1_0/user/profile",
        headers:{
          Authorization:`Bearer ${user.token}`
        }
      })
}


// 修改用户头像
// 注意： data 必须传递 FormData 对象
export const updateUserPhoto = data =>{
  return  request({
        method: "PATCH",
        url: "/mp/v1_0/user/photo",
       data
      })
}

// 修改用户基本信息
export const updateUserProfile = data =>{
  return  request({
        method: "PATCH",
        url: "/mp/v1_0/user/profile",
      })
}